package com.fancy.learncenter.ui.view;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.andview.refreshview.utils.Utils;
import com.fancy.learncenter.R;

/**
 * Created by hyy on 2018/6/8.
 */

public class PromptDialog extends Dialog {
    Context mContext;

    public PromptDialog(@NonNull Context context) {
        super(context);
        this.mContext = mContext;
    }

    public PromptDialog(@NonNull Context context, int themeResId, Context mContext) {
        super(context, themeResId);
        this.mContext = mContext;
    }

    private void initView() {

        this.setCanceledOnTouchOutside(false);
        Window window = this.getWindow();
        window.setContentView(R.layout.layout_prompt_dialog);
        window.setGravity(Gravity.CENTER);
        WindowManager.LayoutParams lp = window.getAttributes();
        int screenW = (int) (Utils.getScreenWidth(mContext) * 0.6);
        lp.width = (int) (screenW);
        window.setLayout(lp.width, lp.WRAP_CONTENT);
        window.setBackgroundDrawableResource(android.R.color.transparent);
        TextView btn_quit = (TextView) window.findViewById(R.id.btn_quit);
        TextView btn_cancel = (TextView) window.findViewById(R.id.btn_cancel);
        btn_quit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        btn_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });
    }

    public void diaShow() {
        this.show();
    }
}
